<template>
	<view class="info-wrap">
		<!-- <view class="info-heder"> -->
			<!-- <text>客户查询</text> -->
		<!-- </view> -->
		<view v-for="(item,index) in customerInfo" :key="index">
			<view class="info-top">
				<view class="vi">
					<view class="left">姓名</view>
					<view class="right">{{item.consultants}}</view>
				</view>
				<view class="vi">
					<view class="left">性别</view>
					<view class="right">{{item.genderText}}</view>
				</view>
				<view class="vi">
					<view class="left">年龄</view>
					<view class="right">{{item.age}} 岁</view>
				</view>
				<view class="vi" :style="style0">
					<view class="left">电话号码</view>
					<view class="right">{{item.phone}}</view>
				</view>
				<view class="vi" :style="style0">
					<view class="left">身份证号</view>
					<view class="right">{{item.idCard}}</view>
				</view>
			</view>
			<view class="info-top">
				<view class="vi">
					<view class="left">客户级别</view>
					<view class="right">{{item.manLevelName}}</view>
				</view>
				<view class="vi" :style="style0">
					<view class="left">职业</view>
					<view class="right">{{item.job}}</view>
				</view>
				<view class="vi" :style="style0">
					<view class="left">车辆</view>
					<view class="right">{{item.carInfo}}</view>
				</view>
				<view class="vi" :style="style0">
					<view class="left">穿着</view>
					<view class="right">{{item.dressedIn}}</view>
				</view>
				<view class="vi">
					<view class="left">产品意向</view>
					<view class="right">{{item.planShortName}}</view>
				</view>
				<view class="vi" :style="style0">
					<view class="left">会员卡费</view>
					<view class="right">{{item.cardFee}} 元</view>
				</view>
				<view class="vi">
					<view class="left">接待人</view>
					<view class="right">{{item.receptionistMan}}</view>
				</view>
				<view class="vi" :style="style0">
					<view class="left">来访时间</view>
					<view class="right">{{item.visitDate}}</view>
				</view>
			</view>
			<!-- <view class="info-top">
				<view>2021/09/09 第一次回访，询问户型</view>
				<view>2021/09/09 第一次回访，询问户型</view>
				<view>2021/09/09 第一次回访，询问户型</view>
				<view>2021/09/09 第一次回访，询问户型</view>
			</view> -->
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id: '',
				style0: "display:none",

				customerInfo: [{
					consultId: "", //ID
					consultants: "", //姓名
					genderText: "", //性别
					age: "", //年龄
					phone: "", //手机号
					idCard: "", //身份证号
					manLevelName: "", //客户级别
					job: "", //职业
					carInfo: "", //车辆
					dressedIn: "", //穿着
					planShortName: "", //产品方案
					cardFee: "", //会员卡费
					receptionistMan: "", //接待人员
					visitDate: "", //来访时间
				}]
			}
		},
		onLoad(option) {
			// this.uuu()
			//console.log("+++++++++++++++++" + option.consultId)
			this.id = option.consultId
			//console.log("========" + this.id)
			this.getCustomerInfo();
		},
		methods: {
			async getCustomerInfo() {
				const res = await this
					.$myRequest({ //await 关键字 只能放在 async 函数内部， await关键字的作用 就是获取 Promise中返回的内容， 获取的是Promise函数中resolve或者reject的值
						url: '/api-sale/control/consult/?consultId=' + this.id,
						method: "get",
					})
				//console.log(res.msg)
				this.customerInfo = res.body.saleConsults.data
				//console.log(this.customerInfo)
				this.uuu()
			},
			uuu() {
				var id = uni.getStorageSync('id')
				var name = uni.getStorageSync('loginName')
				//console.log("id=" + id)
				//console.log("name=" + name)
				//console.log("receptionistMan=" + this.customerInfo[0].receptionistMan)
				if (name == this.customerInfo[0].receptionistMan) {
					this.style0=''
				}
			},
		}
	}
</script>

<style>
	page {
		background-color: #ebeff6;
	}

	.info-heder {
		width: 100%;
		height: 120rpx;
		background-color: #109ef8;
		text-align: center;
	}

	.info-heder text {
		color: white;
		font-weight: 600;
		font-size: 38rpx;
		/* margin-left: 50rpx; */
		word-spacing: 100rpx;
	}

	.info-top {
		background-color: #FFFFFF;
		margin-bottom: 20rpx;
		/* font-size: 24rpx; */
	}

	.vi {
		height: 80rpx;
		width: 100%;
		display: flex;
		border-bottom: 1rpx solid #ebebeb;
		align-items: center;
	}

	.left {
		margin-left: 20rpx;
		width: 30%;
		color: #606060;
		font-weight: bold;
		font-size: 28rpx;
	}

	.right {
		width: 70%;
		color: #BBBBBB;
		font-size: 28rpx;
		font-weight: bold;
	}

	.info-wrap {
		align-items: center;
		justify-content: center;
	}
</style>
